package com.company.设计模式.单例模式.result;

/**
 * @author uguoy089
 *
 * 以枚举类的形式来将不同情况作出相应的状态提示
 */

public enum Status {
    /*这里是可以自己定义的，方便与前端交互即可*/
    UNKNOWN_ERROR(-1,"未知错误"),
    SUCCESS(10000,"成功"),
    FAILURE(20000,"失败"),
    USER_NOT_EXIST(1,"用户不存在"),
    USER_IS_EXISTS(2,"用户已存在"),
    DATA_IS_NULL(3,"数据为空");

    private int code;
    private String msg;

    Status(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "Status{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }
}
